package com.mars.seckill.client;

import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

public class SeckillThread extends Thread{

    @Override
    public void run() {
        // RestTemplate是spring封装好的，用于访问restful服务的模板类
        RestTemplate restTemplate = new RestTemplate();
        String user = Thread.currentThread().getName();
        String url = "http://localhost:8080/buy/computer/"+user;
        // get方式访问url，并将结果封装成给定的结果类，这里是String
        ResponseEntity<String> entity = restTemplate.getForEntity(url,String.class);
        //System.out.println(entity.getBody());
    }
}
